<?php
class CacheModule
{
	public $base;

	public function __construct(&$base) 
	{
		$this->db = $base->db;
		$this->cache = $base->cache;
	}
	
	function memberList()
	{
		if (($censors = $this->cache->get('_member')) === false){
			$sql = 'SELECT uid, username, password	FROM cdb_members';
			$result = $this->db->fetchAll($sql);

			$this->cache->put('_member', $result);
		}
		return $censors;
	}
	
	function arrList()
	{
		if (($arr = $this->cache->get('_arr')) === false){
			$arr = array(1,2,3,4,5,6);
			$this->cache->put('_arr', $arr);
		}
		
		return $arr;
	}
	
	function dbcache()
	{
		$sql = 'SELECT uid, username, password	FROM cdb_members';
		$result = $this->db->query($sql, 3600);

		while ($row = $this->db->fetchRow($result)) {
			$rowset[] = $row;

		}
		
		$this->db->freeResult($result);
		var_dump($rowset);
		
	}
}
?>